package com.yxq.mdt.app.modules.arouter;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;

import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.facade.callback.NavCallback;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ToastUtils;

/**
 * @author L
 * @time
 * @describe 新建一个Activity用于监听Scheme事件, 之后直接把url传递给ARouter即可
 */
public class SchemeFilterActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Uri uri = getIntent().getData();
        ARouter.getInstance().build(uri).navigation(this, new NavCallback() {
            @Override
            public void onArrival(Postcard postcard) {
                finish();
            }

            @Override
            public void onLost(Postcard postcard) {
                super.onLost(postcard);
                ToastUtils.showShort("找不到对应的页面");
            }

            @Override
            public void onFound(Postcard postcard) {
                super.onFound(postcard);
            }
        });
    }
}